﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;

namespace abilityMap
{
    public partial class Form1 : Form
    {
        public ChromiumWebBrowser browser;
        public string otype = "all";
        public Form1()
        {
            InitializeComponent();
            //// 初始化CEF
            var settings = new CefSettings();
            settings.CefCommandLineArgs.Add("disable-web-security", "1");
            //settings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
            Cef.Initialize(settings);

            string url = System.Environment.CurrentDirectory + "\\" + "treeMap.html";
            this.browser = new ChromiumWebBrowser(url);
            this.browser.Dock = DockStyle.Fill;
            this.panel1.Controls.Add(browser);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (otype != "all")
            {
                this.browser.ExecuteScriptAsync("switchModule('all')");
                otype = "all";
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (otype != "2023")
            {
                this.browser.ExecuteScriptAsync("switchModule('2023')");
                otype = "2023";
            }
        }
    }
}


